package eaxm;

import java.util.Scanner;

/**
 * @Auther:小陈的Java
 * 用递归实现**斐波那契数列；斐波那契数列**：指的是这样一个数列 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55...
 */
public class Number6 {
    public static int fib(int n){
        if (n == 0){
            return 0;
        }else if (n == 1 || n == 2){
            return 1;
        }else {
            return fib(n-2)+fib(n-1);
        }
    }

    public static void main(String[] args) {
        Scanner input =new Scanner(System.in);
        System.out.println("请输入要显示到第几位数");
        int n = input.nextInt();
        for(int i=0;i<=n;i++){
            System.out.print(fib(i)+"\t");
        }
    }
}
